package Hbase;

import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.hbase.HBaseConfiguration;
import org.apache.hadoop.hbase.client.HTable;
import org.apache.hadoop.hbase.client.Put;
import org.apache.hadoop.hbase.util.Bytes;

import java.io.IOException;

public class UpdateData {
    public static void Amend(String id,String name,String data,String number,String status,String term) throws IOException {

        Configuration conf = HBaseConfiguration.create();
        conf.set("hbase.zookeeper.quorum","niit01");

        HTable table = new HTable(conf,"students");

        Put put = new Put(Bytes.toBytes(id));

        put.add(Bytes.toBytes("Name"),Bytes.toBytes(""),Bytes.toBytes(name));
        put.add(Bytes.toBytes("Data"),Bytes.toBytes(""),Bytes.toBytes(data));
        put.add(Bytes.toBytes("Number"),Bytes.toBytes(""),Bytes.toBytes(number));
        put.add(Bytes.toBytes("Status"),Bytes.toBytes(""),Bytes.toBytes(status));
        put.add(Bytes.toBytes("Term"),Bytes.toBytes(""),Bytes.toBytes(term));
        table.put(put);
        System.out.println("Data Inserted Successfully");
    }
}
